Brief History of R

1992: Robert Gentleman and Ross Ihaka develop an early version of R for teaching.

1995: Martin Mächler (ETH Zurich) persuades Robert and Ross to release R under a GNU public license.

… User community grows to millions world wide…

30 years as an open source project: How can the community help to sustain R?

Localization

Localization

By default, messages, warnings and errors are shown in the current locale.

The language can be changed with Sys.setLanguage:

> Sys.setLanguage("es")
> months[1]
Error in months[1] : objeto de tipo 'closure' no es subconjunto

If no translation is available, the English is shown:

> help(c("mean", "sd"))
Error en help(c("mean", "sd")): 
  'topic' should be a name, length-one character vector or reserved word

PO & POT Files

Translation via Weblate

The Weblate instance at https://translate.rx.studio provides a user-friendly interface for contributing translations.

Screenshot of Weblate hompage, showing three translation projects with some translation coverage summary statistics including % translated and number of unfinished strings.

The R Project for Statistical Computing

Screenshot of the R Project for Statistical Computing project on weblate, with per package translation coverage summaries
  • Most packages have two components for strings in R and C files
  • Also translate strings in the Windows and Mac GUIs

Languages tab

Screenshot of the language tab for the R Project for Statistical Computing project, with per language translation coverage summaries
  • 27 (written) languages in current release of R, including Spanish and Brazilian Portuguese

Translation interface

Screenshot of the translation interface for translation of a specific string. Shows the english message with an empty box to type the Spanish translation

Enter the translation and “Suggest” (if unsure) or “Save and continue” (if confident).

Sidebar shows alerts and any relevant terms from glossary.

Machine translation

Screenshot of the translation interface for translation of a specific string. Shows the english message with an empty box to type the Spanish translation
  • “Clone to translation” will copy and mark as “needs editing”
  • “Accept” will accept suggestion, save and continue

Latin American Contributions

Top: Translators on Weblate. Bottom: Translators at LatinR 2023

  • Many contributors from the LatinR community on Weblate
  • Several joined via contributor events e.g. at LatinR 2022 - 2024
  • Big improvement in base R translations since Weblate set up in 2022:
    • Spanish: from 24% to 100% translated
    • Brazilian Portuguese: from 48% to 85% translated

Ongoing work

  • Translation of messages in recommended packages:
    • Spanish: 85% translated
    • Brazilian Portuguese: 57% translated
  • Updating translations as source messages change
    • R Core Team update 1-2 times a year

R Code and Documentation

Bugs Reports and Feature Requests

Contributors can help in several ways:

  • Reviewing bug reports
  • Creating a “reprex”
  • Debugging R code
  • Discussing how to fix
  • Developing a patch
  • Testing a patch
  • Debugging C code

Warning

Contributions on the right require building R from source

Building R as a Barrier to Contribution

  • A lot of information to digest
  • Hard to trouble-shoot issues
  • Many pre-requisities to install
  • Can interfere with existing R installation

Caution

Can be a big time sink for ad-hoc contributors!

R Dev Container

The R Dev Container provides a development environment that can be run in the browser:

R Dev Container Features

  • Launch with GitHub Codespaces (60 hours/month free usage)
  • Fixed Linux (Ubuntu) environment, isolated from local system
    • Pre-requisites for building R installed
  • Docs with mini tutorials:

R Contribution Workflow

R Contribution Workflow: Build R

Checkout R Sources I

Checkout R Sources II

Create and Move to Build Directory

Configure the Build I

Configure the Build II

Build R!

Basic check I

Basic check II

Use R-devel in R terminals

R Contribution Workflow: Edit Source

Bugzilla

Bugs and feature requests a tracked on R’s Bugzilla https://bugs.r-project.org

Screenshot of the home page for R's Bugzilla.

Open Bugs

Screenshot of the list of open bugs on R's Bugzilla.

Bug 7084: A Good First Issue

Bug 7084 is an example of a good first issue:

  • There is a simple reproducible example.
  • An R Core developer (Martin Maechler) agrees it is a bug.
  • There is an outline solution approved by the R Core developer.
  • The fix only requires editing R code.

Bug 7084: The Problem

text() recycles coordinate pairs when there are more labels than points

plot(1:7); text(1:2, 2:4, LETTERS[1:4])

Bug 7084: Outline Solution

if (length(labels) > (n <- max(length(x), length(y))) && n >= 1) {
   ## use labels[1:n]  and warn about length(labels) >= .. or "omitting labels[...]"
}
if (length(labels) < n) { 
  ## recycle labels to length `n`  without a warning
}

Start R I

Start R II

Explore text()

Get methods

Finding the Source with the r-svn GitHub Mirror I

Finding the Source with the r-svn GitHub Mirror II

Finding the Source with the r-svn GitHub Mirror III

Debugging text.default()

> debug(text.default)
> plot(1:7); text(1:2, 2:4, LETTERS[1:4])
debugging in: text.default(1:2, 2:4, LETTERS[1:4])
debug: {
    if (!missing(y) && (is.character(y) || is.expression(y))) {
        labels <- y
        y <- NULL
    }
    x <- xy.coords(x, y, recycle = TRUE, setLab = FALSE)
    labels <- as.graphicsAnnot(labels)
    if (!is.null(vfont)) 
        vfont <- c(typeface = pmatch(vfont[1L], Hershey$typeface), 
            fontindex = pmatch(vfont[2L], Hershey$fontindex))
    .External.graphics(C_text, x, labels, adj, pos, offset, vfont, 
        cex, col, font, ...)
    invisible()
}
Browse[1]> 

Press Enter to step through the code

debug: if (!missing(y) && (is.character(y) || is.expression(y))) {
    labels <- y
    y <- NULL
}
Browse[1]> 
debug: x <- xy.coords(x, y, recycle = TRUE, setLab = FALSE)
Browse[1]> 
debug: labels <- as.graphicsAnnot(labels)
Browse[1]>

Test code at this point

Browse[1]> x
$x
[1] 1 2 1

$y
[1] 2 3 4

$xlab
NULL

$ylab
NULL
  • The labels are already recycled to length n
  • Our warnings should be based on x rather than the original arguments

Return to the Source File

Screenshot of the home page for R's Bugzilla.

Edit the Code

Screenshot of the home page for R's Bugzilla.

Edit the Documentation

Screenshot of the home page for R's Bugzilla.

R Contribution Workflow: Rebuild R

Quit R

Screenshot of the home page for R's Bugzilla.

Rebuild R

Screenshot of the home page for R's Bugzilla.

Test reprex

Screenshot of the home page for R's Bugzilla.

R Contribution Workflow: Run check

Basic check

Screenshot of the home page for R's Bugzilla.

Fail!

Screenshot of the home page for R's Bugzilla.

Look at test output

Screenshot of the home page for R's Bugzilla.

Run test code

Screenshot of the home page for R's Bugzilla.

R Contribution Workflow: Further edits

Further edits

Screenshot of the home page for R's Bugzilla.

R Contribution Workflow: Rebuild again

R Contribution Workflow: Run check again

Full check

Screenshot of the home page for R's Bugzilla.

R Contribution Workflow: Create patch

Create patch

Screenshot of the home page for R's Bugzilla.

Download patch

Screenshot of the home page for R's Bugzilla.

Going Further

Get Involved